$(function(){
	//点击找回密码，然后触发遮罩层和要显示的div层
	$('#zhaohui_jquery').click(function(){
		 $("#bg").css({
	            display: "block", height: $(document).height()
	        });
		 var $zhaohui=$('.zhaohui');
		$zhaohui.css({
			left:200+"px",
			top:40+"px",
			display:"block",
		});
	});
	//找回第一步的时候的取消按钮
	$('#zhaohui_quxiao_button').click(function(){
		$('#bg,.zhaohui').css("display","none");
	});
	//用户在第一步输入卡号、身份证号、取款密码后提交下一步按钮
	$('#zhaohui_next_button').click(function(){
		var u="UserServlet?instatus=zhaohui_one";
		$.ajax({
			type:"post",
			url:u,
			data:$('#zhaohui_one_form').serialize(),
			datatype:'json',
			success:function(msg){
				if(msg==0){
					$('#zhaohui_one_cardid').empty();
					$('#zhaohui_one_userid').empty();
					$('#zhaohui_one_pass').empty();
					$('#zhaohui_one_cardid').html("<font size='1' color='red'>*您输入的卡号不存在</font>");
				}else if(msg==1){
					$('#zhaohui_one_cardid').empty();
					$('#zhaohui_one_userid').empty();
					$('#zhaohui_one_pass').empty();
					$('#zhaohui_one_userid').html("<font size='1' color='red'>*身份证号和卡号不匹配</font>");
				}else if(msg==2){
					$('#zhaohui_one_cardid').empty();
					$('#zhaohui_one_userid').empty();
					$('#zhaohui_one_pass').empty();
					$('#zhaohui_one_pass').html("<font size='1' color='red'>*取款密码输入错误</font>");
				}else if(msg==3){
					$('#zhaohui_one_cardid').empty();
					$('#zhaohui_one_userid').empty();
					$('#zhaohui_one_pass').empty();
					$('.zhaohui').css("display","none");
					$('#zhaohui_two').css({
						left:200+"px",
						top:40+"px",
						display:"block",
					});
				}
			},
			error:function(){
				alert("错误信息");
			}
		});
	});
	//选择更改密码时的上一步按钮
	$('#zhaohui2_yes_before').click(function(){
		$('#zhaohui_two').css("display","none");
		 var $zhaohui=$('.zhaohui');
			$zhaohui.css({
				left:200+"px",
				top:40+"px",
				display:"block",
			});
	});
	//选择更改密码时的取消按钮
	$('#zhaohui2_yes_cancel').click(function(){
		$('#bg,#zhaohui_two').css("display","none");
	});
	//选择不更改密码时的上一步按钮
	$('#zhaohui2_no_before').click(function(){
		$('#zhaohui_two').css("display","none");
		var $zhaohui=$('.zhaohui');
		$zhaohui.css({
			left:200+"px",
			top:40+"px",
			display:"block",
		});
	});
	//选择不更改密码时的取消按钮
	$('#zhaohui2_no_cancel').click(function(){
		$('#bg,#zhaohui_two').css("display","none");
	});
	$('#yon_yes').click(function(){
		$('#oldpass_input').css("display","none");
		$('#zhaohui2_no_anniu').css("display","none");
		$('#newpass_confirm').css("display","block");
		$('#zhaohui2_yes_anniu').css("display","block");
	});
	$('#yon_no').click(function(){
		$('#newpass_confirm').css("display","none");
		$('#zhaohui2_yes_anniu').css("display","none");
		$('#oldpass_input').css("display","block");
		$('#zhaohui2_no_anniu').css("display","block");
		
	});
	$('#zhaohui2_yes_next').click(function(){
		//此处缺少数据库里修改数据
		var u="UserServlet?instatus=zhaohui_two_yes";
		$.ajax({
			type:"post",
			url:u,
			data:$('#zhaohui_two_form').serialize(),
			datatype:'json',
			success:function(msg){
				if(msg==0){
					$('#zhaohui2_yes_div').html("<font size='1' color='red'>两次密码输入不一致</font>")
				}else if(msg==1){
					$('#zhaohui_two').css("display","none");
					$('#zhaohui_three').css({
						left:200+"px",
						top:40+"px",
						display:"block",
					});
				}
			},
			error:function(){
				alert("错误信息");
			}
		});
	});
	$('#zhaohui2_no_login').click(function(){
		var u="UserServlet?instatus=zhaohui_two_no";
		$.ajax({
			type:"post",
			url:u,
			data:$('#zhaohui_two_form').serialize(),
			datatype:'json',
			success:function(msg){
				if(msg==0){
					$('#zhaohui2_no_div').html("<font size='1' color='red'>密码输入错误</font>")
				}else if(msg==1){
					$('#zhaohui_two,#bg').css("display","none");
					window.location.href="Loged.jsp";
				}
			},
			error:function(){
				alert("错误信息");
			}
		});
	});
	$('#zhaohui_three_login').click(function(){
		var u="UserServlet?instatus=zhaohui3_login";
		$.ajax({
			type:"post",
			url:u,
			datatype:'json',
			success:function(msg){
				if(msg==0){
					$('#div_log_name').empty();
					$('#div_log_pass').empty();
					$('#div_log_name').html("<font color='red' size='1'>*用户不存在</font>");
				}else if(msg==1||msg==3){
					$('#div_log_name').empty();
					$('#div_log_pass').empty();
					$('#div_log_pass').html("<font color='red' size='1'>*密码输入错误</font>");
				}else if(msg==2||msg==4){
					window.location.href="Loged.jsp";
				}
			},
			error:function(){
				alert("错误信息");
			}
		});
	});
	//找回第三步关闭按钮
	$('#zhaohui_three_close').click(function(){
		$('#zhaohui_three,#bg').css("display","none");
	});
	//点击银行账户，设定和首页都关闭
	$('#yinhang_zhanghu').click(function(){
		$('#sheding,#huan').css("display","none");
		$('#zhanghu,#div_jubu_n').css("display","block");
	});
	//点击个人设定，银行账户和首页都关闭
	$('#geren_sheding').click(function(){
		$('#zhanghu,#huan').css("display","none");
		$('#sheding,#div_jubu_n').css("display","block");
	});
	//点击首页，银行账户和个人设定都关闭
	$('#shouye').click(function(){
		$('#sheding,#zhanghu,#div_jubu_n').css("display","none");
		$('#huan').css("display","block");
	});
	//点击欢迎信息修改按钮执行的操作
	$('#welcome_button').click(function(){
		var u="UserServlet?instatus=welcome";
		$.ajax({
			type:"post",
			url:u,
			data:$('#welcome_form').serialize(),
			datetype:'json',
			success:function(msg){
				if(msg==0){
					$('#welcome_div').html("<font size='1' color=red>*欢迎信息不可为空</font>");
				}else if(msg==1){
					$('#welcome_div').html("<font size='1' color=red>欢迎信息修改成功</font>");
				}
			},
			error:function(){
				alert("错误信息");
			}
		});
	});
	$('#bianji_user').click(function(){
		$('#div_jubu_user').load('Selectuser_bianji.jsp');
	});
	$('#tijiao_user').click(function(){
		var u="UserServlet?instatus=bianji_user";
		$.ajax({
			type:"post",
			url:u,
			data:$('#bianji_user_form').serialize(),
			datatype:'json',
			success:function(msg){
				if(msg==0){
					$('#tijiao_div').empty();
					$('#tijiao_div').html("<font size='1' color='red'>*电话号码不可为空</font>");
				}else if(msg==1){
					$('#tijiao_div').empty();
					$('#tijiao_div').html("<font size='1' color='red'>*用户名不可为空</font>")
				}else if(msg==2){
					$('#tijiao_div').empty();
					$('#div_jubu_user').load('Selectuser_show.jsp');
				}
			},
			error:function(){
				alert("错误信息");
			}
		});
	});
	
})